<?php
declare (strict_types=1);

namespace app\platform\controller;

use think\facade\View;

class Index extends PlatformBase
{
    public function initialize(): void
    {
        parent::initialize();
    }

    public function index(): string
    {
        $merchantUserObj = new \app\platform\business\Merchant();
        $merchant        = $merchantUserObj->getMerchantUserFromSession();
        $menuBusiness    = new \app\common\business\Menu();
        $menus           = $menuBusiness->getPlatformPermissionMenus($merchant['roleIds']);
        $actions         = $menuBusiness->getLoginRolPermissionActions($merchant['roleIds']);
        View::assign([
            'merchant' => $merchant,
            'menus'    => $menus,
            'actions'  => $actions['menuCodes'],
        ]);

        return View::fetch();
    }

    public function console(): string
    {
        $list = $this->request->param("list", 0, 'intval');
        View::assign(['list' => $list]);
        return View::fetch();
    }
}
